import request from "@/request/request";
import requestMock from "@/request/requestMock";

//1. 请求三级分类列表
export const reqCategoryList = () => {
    return request.get("/product/getBaseCategoryList");
};
//2. 请求轮播图的mock数据
export const reqBannerList = () => {
    return requestMock.get("/home/banner");
};
//3. 请求首页的floor数据
export const reqFloorList = () => {
    return requestMock.get("/home/floor");
};
//4.请求搜索search数据
export const reqSearchList = (searchParams) => {
    return request.post("/list", searchParams);
};
//5. 请求某个商品的详情数据
export const reqGoodDetail = (skuId) => {
    return request.get(`/item/${skuId}`);
};
//6. 添加购物车和对已有商品数量修改
export const reqAddCartOrUpdataCart = (skuId, skuNum) => {
    return request.post(`/cart/addToCart/${skuId}/${skuNum}`);
};
// 7. 获取购物车列表
export const reqCartList = () => {
    return request.get(`/cart/cartList`);
};
// 8. 删除购物车商品
export const reqDeleteCart = (skuId) => {
    return request.delete(`/cart/deleteCart/${skuId}`);
};
// 9. 修改购物车单个状态
export const reqChangeChecked = (skuID, isChecked) => {
    return request.get(`/cart/checkCart/${skuID}/${isChecked}`);
};
// 10. 批量选中购物车
export const reqAllSelectCart = (skuIdList, isChecked) => {
    return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList);
};
// 11. 删除已选中商品
export const reqDeleteAllSelectCart = (skuIdList) => {
    return request.delete(`/cart/batchDeleteCart`, {
        data: skuIdList,
    });
};
// 12. 获取验证码
export const reqVerifyCode = (phone) => {
    return request.get(`/user/passport/sendCode/${phone}`);
};
// 13. 注册
export const reqRegister = (userInfo) => {
    return request.post(`/user/passport/register`, userInfo);
};
//14. 登录
export const reqLogin = (userInfo) => {
    return request.post(`/user/passport/login`, userInfo);
};
// 15. 根据token获取用户信息
export const reqUserInfo = () => {
    return request.get(`/user/passport/auth/getUserInfo`);
};
// 16. 退出登录
export const reqLogout = () => {
    return request.get(`/user/passport/logout`);
};
